package WaiBao;

import com.sun.corba.se.impl.interceptors.PICurrent;

import java.util.Arrays;

public class LiCan {
    public static void main(String[] args) {
        String[] name = {"杨洋(班长)","易烊千玺(团支书)", "小李(学习委员)","王俊卡(文艺委员)", "黄子韬", "李鹏博", "李道伟", "谢霆锋", "成龙", "白敬亭", "刘昊然", "王宝强",
                "张丽", "张晓红", "李大红", "翠花", "李娟", "王娟", "宋娟", "李贺", "杜牧", "吕布", "司控证", "司马懿", "小乔", "大乔", "妲己", "纣王",
                "杨玉环", "李灿(学生)"};//考生本人: 李灿(学生)
        int[] age = {20, 18, 18, 17, 19, 20, 19, 21, 19, 19, 18, 18, 18, 20, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 18, 20, 18, 18, 18};//最后一位：考生年龄:18
//        for (int i = 0; i < name.length; i++) {
//            System.out.println("姓名:"+name[i]+" "+"年龄:"+age[i]);
//        }

        double[] FS1 = {68, 72, 76, 84, 77, 79, 78, 89, 81, 90, 91, 87, 85, 79, 65, 68, 99, 99, 96, 88, 92, 91, 95, 65, 75, 74, 94, 74, 88, 94};
        double[] FS2 = {87, 85, 78, 76, 68, 97, 98, 69, 70, 90, 90, 77, 66, 85, 65, 65, 76, 99, 66, 98, 72, 71, 95, 86, 75, 88, 84, 64, 80, 94};
        double[] FS3 = {92, 69, 84, 95, 78, 69, 78, 69, 80, 80, 93, 87, 85, 65, 65, 68, 69, 96, 96, 93, 92, 81, 65, 95, 76, 84, 73, 71, 89, 95};

        double zongfen ;//代表每个学生的总分
        double pingjunfen;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            zongfen  = FS1[i] + FS2[i] + FS3[i];
//            pingjunfen = (zongfen * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + zongfen);
//            System.out.println(name[i] + "的平均分为:" + pingjunfen);
//        }



        double fenshu = 0,pingjun= 0;
        double[] shuchujieguo  = new double[30];
//        for (int i = 0; i < 30; i++) {
//            fenshu = FS1[i] + FS2[i] + FS3[i];
//           pingjun = (fenshu* 1.0) / 3;
//            shuchujieguo  [i] =pingjun;
//        }
//
//        for (int i = 0; i <  shuchujieguo  .length - 1; i++) {
//            for (int j = 0; j <  shuchujieguo  .length - i - 1; j++) {
//                if (shuchujieguo  [j] < shuchujieguo  [j + 1]) {
//                    double tep =  shuchujieguo  [j];
//                    shuchujieguo [j] = shuchujieguo [j + 1];
//                    shuchujieguo [j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println( shuchujieguo  [i]);
//        }



        double SIX1 = 0, SIX2 = 0,SIX3 = 0;//计算每门课的平均分
        double Seven1 = 0, Seven2 = 0, Seven3 = 0;//计算每门课标准差
        double Eight1 = 0, Eight2 = 0, Eight3 = 0;//计算每门课中位数
//        double he = 0;
//        for (int i = 0; i < FS1.length; i++) {
//            he += FS1[i];
//        }
//        SIX1 = (he * 1.0) / 30;
//        System.out.println("农业设施及环境调控的班级平均分为:" +SIX1);
//        double Sum = 0;
//        for (int i = 0; i < FS2.length; i++) {
//            Sum +=FS2[i];
//        }
//        SIX2 = (Sum * 1.0) / 30;
//        System.out.println("农业设施设计与建造的班级平均分为:" + SIX2);
//        double sum = 0;
//        for (int i = 0; i < FS3.length; i++) {
//            sum +=FS3[i];
//        }
//        SIX3 = (sum * 1.0) / 30;
//        System.out.println("园艺植物设施栽培学的班级平均分为:" + SIX3);



        double c1 = 0, c2 = 0, c3 = 0;
        for (int i = 0; i <FS1.length; i++) {
            c1 += (FS1[i] - SIX1) * (FS1[i] - SIX1);
        }
        Seven1 = Math.sqrt(c1*1.0/30);
        System.out.println("农业设施及环境调控的班级标准差为:" +  Seven1);
        for (int i = 0; i < FS2.length; i++) {
            c2 += (FS2[i] - SIX2) * (FS2[i] -SIX2);
        }
        Seven2 = Math.sqrt(c2*1.0/30);
        System.out.println("农业设施设计与建造的班级标准差为:" + Seven2);

        for (int i = 0; i <FS3.length; i++) {
            c3 += (FS3[i] - SIX3) * (FS3[i] - SIX3);
        }
        Seven3 = Math.sqrt(c3*1.0/30);
        System.out.println("园艺植物设施栽培学的标准差为:" +  Seven3);
//
//
//        Arrays.sort(FS1);
//        Arrays.sort(FS2);
//        Arrays.sort(FS3);
//        Eight1 = (FS1[15] + FS2[16]) * 1.0 / 2;
//        Eight2 = (FS2[15] +FS2[16]) * 1.0 / 2;
//        Eight3 = (FS3[15] + FS3[16]) * 1.0 / 2;
//        System.out.println("农业设施及环境调控的中位数为:" +  Eight1);
//        System.out.println("农业设施设计与制造的中位数为:" +  Eight2);
//        System.out.println("园艺植物设施栽培学的中位数为:" +  Eight3);

    }
}
